package com.yjhb.android.sbz.mvp.appupdate;

import com.yjhb.android.sbz.entity.AppVersion;
import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.mvp.ConventionPresenter;
import com.jojo.android.zxlib.base.mvp.CommonView;

/**
 * 创建者 zx
 * 创建时间 2020/12/31 16:53
 */
public class AppUpdatePresenter extends ConventionPresenter<CommonView<AppVersion>> {
    private final String TAG = "AppUpdatePresenter";

    @Override
    protected void onDestroy() {

    }

    public AppUpdatePresenter(CommonView<AppVersion> appVersionCommonView) {
        super(appVersionCommonView);
    }


    public void getAppLastVersion() {
        if (view != null) {
            view.onWait();
        }
        HttpTool.request(model.appLastVersion(1), new HttpObserver<AppVersion>() {
            @Override
            public void onResult(AppVersion data) {
                if (view != null) {
                    view.onSuccess(data);
                }
            }

            @Override
            public void onError(int code, String msg) {
                if (view != null) {
                    view.onFailure(code, msg);
                }
            }
        });
    }
}
